package com.czhouse.controller;

import com.czhouse.pojo.HouseVilage;
import com.czhouse.pojo.Houses;
import com.czhouse.pojo.Villages;
import com.czhouse.service.HouseService;
import com.czhouse.vo.PageHouse;
import com.czhouse.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("house")
public class HouseInfoController {
    @Autowired
    private HouseService houseService;
    @PostMapping("add")
    public SysResult addHouseInfo(@RequestBody Houses houses){
        System.out.println(houses);
        houseService.addHouseInfo(houses);
        return SysResult.success();

    }
    @GetMapping("getAll")
    public SysResult getAll(Integer userid){
        System.out.println(userid);
        PageHouse pageHouse=houseService.getAll(userid);
        return SysResult.success(pageHouse);

    }
    @PutMapping("update")
    public SysResult update(@RequestBody Houses houses){
        System.out.println(houses);
        houseService.update(houses);
        return SysResult.success();

    }
}
